
package com.qipay.mapper;

import com.qipay.baas.model.Order;
import com.qipay.baas.model.OrderInfo;
import com.qipay.core.entity.ValueObject;
import com.qipay.order.vo.*;
import com.qipay.sp.dto.SpUserOrderListDto;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface OrderInfoMapper {
    @Select({
            "select",
            "id,amount,userId,mark,status_info",
            "from `order_notify`",
            "where status_info = 'false'"
    })
    @Results({
            @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
            @Result(column="amount", property="amount", jdbcType=JdbcType.VARCHAR),
            @Result(column="userId", property="userId", jdbcType=JdbcType.VARCHAR),
            @Result(column="mark", property="mark", jdbcType=JdbcType.VARCHAR),
            @Result(column="status_info", property="status_info", jdbcType=JdbcType.VARCHAR)
    })
    List<OrderInfo> selectAll();

    @Update({
            "update `order_notify`",
            "set `status_info` = 'true'",
            "where `mark` = #{mark,jdbcType=VARCHAR}"
    })
    int updateByMark(@Param("mark") String mark);


    @Insert({
            "insert into `order_notify` (`amount`, `userId`, ",
            "`mark`, `status_info`)",
            "values (#{amount,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, ",
            "#{mark,jdbcType=VARCHAR}, #{status_info,jdbcType=VARCHAR})"
    })
    int insert(OrderInfo record);
}